import tkinter as tk
from tkinter import ttk
from ttkthemes import themed_tk
# import multiprocessing as mp
from console import Interpreter
from node import NodeEditor
from objects import ObjectTree
from modules import ModuleTree
from mainmenu import MainMenu
from project import SaveData
from animation import Animation
from widget import Notebook

class App(themed_tk.ThemedTk):
	def __init__(self):
		themed_tk.ThemedTk.__init__(self)
		self.set_theme("arc")		
		ttk.Style(self)	

		self.horizontal_panel = ttk.PanedWindow(self, orient="horizontal")
		self.vertical_panel = ttk.PanedWindow(self, orient="vertical")		
		self.side_view = Notebook(self, has_labels=True)
		
		self.node = NodeEditor(self)
		self.console = Interpreter(self)
		self.modules = ModuleTree(self)
		self.objects = ObjectTree(self)

		self.vertical_panel.add(self.node.frame)
		self.vertical_panel.add(self.console.frame)
		self.side_view.add("引入的模块", self.modules)
		self.side_view.add("创建的对象", self.objects)
		self.horizontal_panel.add(self.side_view.frame)
		self.horizontal_panel.add(self.vertical_panel)
		self.horizontal_panel.pack(side="left", fill="both", expand=True)
		
		self.animate = Animation(self)
		self.project = SaveData(self)						
		self.menu = MainMenu(self)
		self.config(menu=self.menu)
		self.project.load(is_first_load=True)

if __name__ == '__main__':
	# mp.freeze_support() #required for windows
	App().mainloop()
